JS: how to call a public method that is defined like this: this.name = function(){return 2;}
Posted
by Totty
on Stack Overflow
See other posts from Stack Overflow
or by Totty
Published on 2010-04-18T19:36:02Z
Indexed on
2010/04/18
19:43 UTC
Read the original article
Hit count: 301
var CoreGroups = new function(){
this.name = function(){return 'name test'};
var functionName = function(){
// here I want to call the name() function
a = this.name(); // doesnt work: this.name is not a function
b = name(); // doesn't work too: name is not defined
}
}
Any idea on how to call the name() function from the functionName() function? Thanks! ;)
© Stack Overflow or respective owner